import request from '@/utils/request'
// 获取区域列表
export function getOrzApi() {
    return request({
        url: '/mini/server/orz',
        method: 'get',
    })
}
// 添加区域列表
export function addOrzApi(data) {
    return request({
        url: '/mini/server/orz',
        method: 'post',
        data
    })
}
// 获取单一列表
export function getOneOrzApi(id) {
    return request({
        url: `/mini/server/orz/${id}`,
    })
}
// 修改单一列表
export function editOneOrzApi(id, data) {
    return request({
        url: `/mini/server/orz/${id}`,
        method: 'put',
        data
    })
}
// 删除单一列表
export function delOneOrzApi(id) {
    return request({
        url: `/mini/server/orz/${id}`,
        method: 'delete',
    })
}
//获取可关联设备
export function getOrzMeterApi(orzId, pageNum, pageSize) {
    return request({
        url: `/mini/server/orz/device`,
        params: {
            orzId,
            pageNum,
            pageSize
        }
    })
}

//关联设备
export function contactOrzMeterApi(data) {
    return request({
        url: `/mini/server/orz/device`,
        method: 'post',
        data
    })
}


/* 
分组管理页面模块
*/
//获取分组列表
export const getGroupApi = () => {
    return request({
      url: `/mini/server/meter/group`,
    })
  }

  //删除分组列表
export const delGroupApi = (groupId) => {
    return request({
      url: `/mini/server/meter/group/${groupId}`,
      method: 'DELETE'
    })
  }
  //新增分组列表
  export const addGroupApi = (data) => {
    return request({
      url: `/mini/server/meter/group`,
      method: 'post',
      data
    })
  }
  // 获取可移入设备
  export const getCanGroupApi = (groupId) => {
    return request({
      url: `/mini/server/meter/group/meters?groupId=${groupId}`,
      groupId
    })
  }
  // 获取单一分组
  export const getOneGroupApi = (groupId) => {
    return request({
      url: `/mini/server/meter/group/${groupId}`,
      method: 'post'
    })
  }
  // 修改单一分组
  export const editGroupApi = (groupId, data) => {
    return request({
      url: `/mini/server/meter/group/${groupId}`,
      method: 'put',
      data
    })
  }